package com.tanfuqi.sicent.protocol.message

import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonValue

class Member(cardId: String = "",
             userName: String = "",
             userPassword: String = "0",
             idCard: String = "",
             idType: Int = 1,
             phoneNumber: String = "",
             memberLevel: MemberLevel = MemberLevel.NORMAL,
             usableIntegral:Int=0,
             var overage: Int = 0,
             var reward :Int= 0) : Body {
     var cardId: String?
        @JsonProperty("card_id")
        get() {
            return field
        }

    private var userName: String?
        @JsonProperty("user_name")
        get() {
            return field
        }

    private var userPassword: String?
        @JsonProperty("user_password")
        get() {
            return field
        }
    private var idCard: String?
        @JsonProperty("id_card")
        get() {
            return field
        }
    private var idType: Int?
        @JsonProperty("id_type")
        get() {
            return field
        }
    private var phoneNumber: String?
        @JsonProperty("phone_number")
        get() {
            return field
        }
    private var memberLevel: MemberLevel?
        @JsonProperty("member_level")
        get() {
            return field
        }
    private var usableIntegral: Int?
        @JsonProperty("usable_integral")
        get() {
            return field
        }

    init {
        this.cardId = cardId
        this.userName = userName
        this.userPassword = userPassword
        this.idCard = idCard
        this.idType = idType
        this.phoneNumber = phoneNumber
        this.memberLevel = memberLevel
        this.usableIntegral =usableIntegral
    }


    enum class MemberLevel private constructor(@get:JsonValue
                                               val value: String) {
        NORMAL("普通会员"), GOLD("黄金会员"), DIAMOND("钻石会员"), EMPLOYEE("工作人员"), GODDESS("联盟女神");

        override fun toString(): String {
            return value
        }

        companion object {

            @JsonCreator
            fun getItem(value: String): MemberLevel? {
                for (item in values()) {
                    if (item.value == value) {
                        return item
                    }
                }
                return null
            }
        }

    }

    //	public String getCardId() {
    //		return cardId;
    //	}
    //
    //	public void setCardId(String cardId) {
    //		this.cardId = cardId;
    //	}
    //
    //	public String getUserName() {
    //		return userName;
    //	}
    //
    //	public void setUserName(String userName) {
    //		this.userName = userName;
    //	}
    //
    //	public String getUserPassword() {
    //		return userPassword;
    //	}
    //
    //	public void setUserPassword(String userPassword) {
    //		this.userPassword = userPassword;
    //	}
    //
    //	public String getIdCard() {
    //		return idCard;
    //	}
    //
    //	public void setIdCard(String idCard) {
    //		this.idCard = idCard;
    //	}
    //
    //	public Integer getIdType() {
    //		return idType;
    //	}
    //
    //	public void setIdType(Integer idType) {
    //		this.idType = idType;
    //	}
    //
    //	public String getPhoneNumber() {
    //		return phoneNumber;
    //	}
    //
    //	public void setPhoneNumber(String phoneNumber) {
    //		this.phoneNumber = phoneNumber;
    //	}
    //
    //	public MemberLevel getMemberLevel() {
    //		return memberLevel;
    //	}
    //
    //	public void setMemberLevel(MemberLevel memberLevel) {
    //		this.memberLevel = memberLevel;
    //	}

}
